package com.oocl.bookproducer;


import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import pojo.Book;

public class BookFileReader {
	private String filename;
	private InputStream in;
	private BufferedReader reader;
	private List<String> bookslist = new ArrayList<String>();
	private String book;
	
	public BookFileReader(String filename) throws Exception{
		this.filename=filename;
		readBooksFromFile();
	}
	
	public void readBooksFromFile() throws Exception{
		in = new FileInputStream(this.filename);
		BufferedReader reader = new BufferedReader(new InputStreamReader(in));  
		while((book=reader.readLine())!=null){
			bookslist.add(book);
		}
		reader.close();
	}

	public List<String> getBookslist() {
		return bookslist;
	}

	public void setBookslist(List<String> bookslist) {
		this.bookslist = bookslist;
	}
	
	
	
	
	
	
}
